<template>
  <button @click="btn">btn</button>
</template>

<script setup lang="ts">
import { inject } from "vue";
// 注入
const provideState: any = inject("provideState");

const btn = () => {
  // 子组件触发name改变
  provideState.numAdd();
};
</script>
